// 该文件是用于打包的入口文件
// 引入样式
import "./styles/main.css"
import "animate.css"
// 引入自定义组件
import { library } from "@fortawesome/fontawesome-svg-core"
import { fas } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"
import Icon from "@/components/Icon"
import Button from "@/components/Button"
import Card from "@/components/Card"
import Dialog from "@/components/Dialog"
import Pager from "@/components/Pager"
import { Collapse } from "@/components/Collapse"
import { CollapseItem } from "@/components/Collapse"
import Tooltop from "@/components/Tooltip"
import type { App } from "vue"
library.add(fas)
// 下面就和main.ts不一样，重点：提供install方法
const componentArr = [Icon, Button, Card, Dialog, Pager, Collapse, CollapseItem, Tooltop]

// vue要求插件提供install名称的函数，use函数要去找install方法
const install = (app: App) => {
	// 全局注册组件
	componentArr.forEach(comp => {
		if (comp.name) {
			app.component(comp.name, comp)
		}
	})
	app.component("FontAwesomeIcon", FontAwesomeIcon)
}

// 导出的两种方式
// 1.全部导出
export default install
// 2.按需导出 - 用户使用import { Icon } from "vue"
export { Icon, Button, Card, Dialog, Pager, Collapse, CollapseItem, Tooltop }
